const state = {
	isLogin: localStorage.getItem('loginStatus') == 'true',
	token: localStorage.getItem('token')
}

const mutations = {
	SET_LOGIN: (state, status) => {
		state.isLogin = status;
		localStorage.setItem('loginStatus',status);
	},
	SET_TOKEN: (state, token) => {
		state.token = token;
		localStorage.setItem('token',token);
	},
}

const actions = {
	setLogin({ commit }, status) {
		commit('SET_LOGIN', status);
	},
	setToken({ commit }, token) {
		commit('SET_TOKEN', token);
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
